#include "Dice.h"
#include <ctime>
#include <cstdlib>
#include <iostream>
#include "Console.h"
#include <Windows.h>

using namespace std;
using namespace Course;


Dice::Dice(void)
{
	srand((unsigned)time(0));
}


Dice::~Dice(void)
{
}

int Dice::throw_dice1()
{
	return rand() % 6 + 1;
}

int Dice::throw_dice2()
{
	return rand() % 6 + 1;
}



void Dice::read(int a, int b)
{
	Console::clrscr();
	for(int i = 0; i < 20; i++){
		Console::gotoxy(i, 0);
		cout << "-";
		Console::gotoxy((i + 25),0);
		cout << "-";
		Console::gotoxy(i, 14);
		cout << "-";
		Console::gotoxy((i + 25), 14);
		cout << "-";
	}
	for(int y = 1; y < 14; y++){
		Console::gotoxy(0, y);
		cout << "!";
		Console::gotoxy(19, y);
		cout << "!";
		Console::gotoxy(25, y);
		cout << "!";
		Console::gotoxy(44, y);
		cout << "!";
	}
	{
	if(a == 1){
		Console::gotoxy(10, 7);
		cout << "x";
	}
	else if(a == 2){
		Console::gotoxy(5, 7);
		cout << "x";
		Console::gotoxy(15, 7);
		cout << "x";
	}
	else if(a == 3){
		Console::gotoxy(5, 7);
		cout << "x";
		Console::gotoxy(15, 7);
		cout << "x";
		Console::gotoxy(10, 10);
		cout << "x";
	}
	else if(a == 4){
		Console::gotoxy(5, 6);
		cout << "x";
		Console::gotoxy(15, 6);
		cout << "x";
		Console::gotoxy(5, 8);
		cout << "x";
		Console::gotoxy(15, 8);
		cout << "x";
	}
	else if(a == 5){
		Console::gotoxy(5, 7);
		cout << "x";
		Console::gotoxy(15, 7);
		cout << "x";
		Console::gotoxy(5, 10);
		cout << "x";
		Console::gotoxy(10, 10);
		cout << "x";
		Console::gotoxy(15, 10);
		cout << "x";
	}
	else if(a == 6){
		Console::gotoxy(5, 10);
		cout << "x";
		Console::gotoxy(15, 10);
		cout << "x";
		Console::gotoxy(10, 10);
		cout << "x";
		Console::gotoxy(5, 7);
		cout << "x";
		Console::gotoxy(15, 7);
		cout << "x";
		Console::gotoxy(10, 7);
		cout << "x";
	}
	}
	{	
	if(b == 1){
		Console::gotoxy(35, 7);
		cout << "x";
	}
	else if(b == 2){
		Console::gotoxy(30, 7);
		cout << "x";
		Console::gotoxy(40, 7);
		cout << "x";
	}
	else if(b == 3){
		Console::gotoxy(30, 7);
		cout << "x";
		Console::gotoxy(40, 7);
		cout << "x";
		Console::gotoxy(35, 10);
		cout << "x";
	}
	else if(b == 4){
		Console::gotoxy(30, 6);
		cout << "x";
		Console::gotoxy(40, 6);
		cout << "x";
		Console::gotoxy(30, 8);
		cout << "x";
		Console::gotoxy(40, 8);
		cout << "x";
	}
	else if(b == 5){
		Console::gotoxy(30, 7);
		cout << "x";
		Console::gotoxy(40, 7);
		cout << "x";
		Console::gotoxy(30, 10);
		cout << "x";
		Console::gotoxy(35, 10);
		cout << "x";
		Console::gotoxy(40, 10);
		cout << "x";
	}
	else if(b == 6){
		Console::gotoxy(30, 10);
		cout << "x";
		Console::gotoxy(40, 10);
		cout << "x";
		Console::gotoxy(35, 10);
		cout << "x";
		Console::gotoxy(30, 7);
		cout << "x";
		Console::gotoxy(40, 7);
		cout << "x";
		Console::gotoxy(35, 7);
		cout << "x";
	}
	}
}